package com.tm.servicemsm.demos;

/**
 * 2024/7/19 实现疫情上报,实现中高风险区上报 Cjj
 */
public class EpidemicReport {
    private String region;//区域
    private int  riskLevel;//风险等级

    public EpidemicReport(String region){
        this.region=region;
    }

    public void setRiskLevel(int riskLevel){
        if(riskLevel<0 || riskLevel>2){
            throw new IllegalArgumentException("风险等级应该是0(低风险),1(中风险),2(高风险)");
        }
        this.riskLevel=riskLevel;
    }

    public void report(){
        if(riskLevel>0){
            System.out.println("中高风险区上报："+region);
        }
    }

    public static void main(String[] args) {
        EpidemicReport report = new EpidemicReport("区域A");
        report.setRiskLevel(1);//设置为中风险
        report.report();//上报
    }
}
